<template>
	<div class="w-h-100" style="padding-top: 20px">
		<el-row :gutter="8" style="width: 100%; height: 100%">
			<el-col :span="12" :xs="24" style="width: 100%; height: 100%">
				<form-component ref="formRef" @submit="(param: any) => submitHandle(param)"> </form-component>
			</el-col>
		</el-row>
	</div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import { formComponent } from '/@/components/ys/index';
import { userInfoConfig } from './config/index';
import cache from '/@/utils/hook/cache';
import { getUserInfoDetail, postChangeUserInfo } from '/@/api/platformWork/index';
import { ElMessage } from 'element-plus';

const formRef = ref();
let data: any = {};
onMounted(() => {
	const showData = async () => {
		const res = await getUserInfoDetail({
			id: cache.getCache('userInfo').id,
		});
		let list: any = userInfoConfig(res.data);
		formRef.value.openDialog(list, '');
	};

	showData();
});
const submitHandle = async (param: any) => {
	const postData = {
		id: cache.getCache('userInfo').id,
		nickName: param.nickName,
		email: param.email,
		sex: param.sex,
		telNum: param.telNum,
		birthday: param.birthday,
	};

	const res: any = await postChangeUserInfo(postData);
	
};
</script>

<!-- scoped属性使style有自己独立的作用域(属性选择器实现 title[data-v-xxx]) -->
<style scoped></style>
